package com.issue.system.service.impl;

import java.util.List;
import com.issue.common.utils.DateUtils;
import com.issue.common.utils.SecurityUtils;
import com.issue.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.issue.system.mapper.DailySummaryMapper;
import com.issue.system.domain.DailySummary;
import com.issue.system.service.IDailySummaryService;

/**
 * SummaryService业务层处理
 * 
 * @author system
 * @date 2024-10-20
 */
@Service
public class DailySummaryServiceImpl implements IDailySummaryService 
{
    @Autowired
    private DailySummaryMapper dailySummaryMapper;

    /**
     * 查询Summary
     * 
     * @param id Summary主键
     * @return Summary
     */
    @Override
    public DailySummary selectDailySummaryById(Long id)
    {
        return dailySummaryMapper.selectDailySummaryById(id);
    }

    /**
     * 查询Summary列表
     * 
     * @param dailySummary Summary
     * @return Summary
     */
    @Override
    public List<DailySummary> selectDailySummaryList(DailySummary dailySummary)
    {
        return dailySummaryMapper.selectDailySummaryList(dailySummary);
    }

    /**
     * 新增Summary
     * 
     * @param dailySummary Summary
     * @return 结果
     */
    @Override
    public int insertDailySummary(DailySummary dailySummary)
    {
        dailySummary.setCreateTime(DateUtils.getNowDate());
        if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
            dailySummary.setCreateBy(SecurityUtils.getUsername());
        }
        return dailySummaryMapper.insertDailySummary(dailySummary);
    }

    /**
     * 修改Summary
     * 
     * @param dailySummary Summary
     * @return 结果
     */
    @Override
    public int updateDailySummary(DailySummary dailySummary)
    {
        dailySummary.setUpdateTime(DateUtils.getNowDate());
        dailySummary.setUpdateBy(SecurityUtils.getUsername());
        return dailySummaryMapper.updateDailySummary(dailySummary);
    }

    /**
     * 批量删除Summary
     * 
     * @param ids 需要删除的Summary主键
     * @return 结果
     */
    @Override
    public int deleteDailySummaryByIds(Long[] ids)
    {
        return dailySummaryMapper.deleteDailySummaryByIds(ids);
    }

    /**
     * 删除Summary信息
     * 
     * @param id Summary主键
     * @return 结果
     */
    @Override
    public int deleteDailySummaryById(Long id)
    {
        return dailySummaryMapper.deleteDailySummaryById(id);
    }
}
